import CryptoJS from 'crypto-js'

// 加密
export function encryptPwd(txt: string, key: string): string {
  const aesKey = CryptoJS.enc.Utf8.parse(key)
  const srcs = CryptoJS.enc.Utf8.parse(txt)
  const encrypted = CryptoJS.AES.encrypt(srcs, aesKey, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  })
  
  return encrypted.toString()
}
